#pragma once

#include <stdarg.h>
#include <ctype.h>
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <memory.h>
#include <time.h>
#include <math.h>
#include <assert.h>

#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <algorithm>
using namespace std;

#pragma warning(disable:4018)	// C4018: '<' : signed/unsigned mismatch
#pragma warning(disable:4996)	// 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
#pragma warning(disable:4819)	// The file contains a character that cannot be represented in the current code page (936)
#include <Windows.h>
#include <tchar.h>
#include "gdi_rst.h"
#define X3_RST	GDI_RST//GL_RST


// Safe Delete
#define  SAFE_DELETE(p)			if(p){ DDELETE(p); (p) = NULL; }
#define  SAFE_DELETE_ARRAY(p)	if(p){ DDELETEARR(p); (p) = NULL; }
#define	 SAFE_RELEASE(p)		if(p){ p->Release(); p = NULL; }
#define  DDELETE(p)				{ delete(p); }
#define  DDELETEARR(p)			{ delete [](p); }

#define NOP { do{}while(0);}

namespace x3
{
	// Basic Function
	template<class T> T min2( T t1, T t2 ) { return t1 < t2 ? t1 : t2; }
	template<class T> T max2( T t1, T t2 ) { return t1 > t2 ? t1 : t2; }
	template<class T> void swap( T& t1, T& t2 ) { T t = t1; t1 = t2; t2 = t; }
	template<class T> T abs( T t ) { return t > 0 ? t : -t; }

	// Resource path
	const char* const RES_PATH		= "res\\";
	const char* const TILE_PATH		= "res\\tile\\";
	const char* const PNG_EXT		= ".png";
	const char* const HGE2_EXT		= ".hge2";
	const char* const SLASH			= "\\";
	const char	CHAR_SLASH	= '\\';
}